﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Data;

namespace AbetEvaluation.Business
{
    public partial class Questions : Component
    {
        public Questions()
        {
            InitializeComponent();
        }

        public Questions(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        public static DataTable GetQuestions(Guid outcomeID)
        {
            Data.DataSet1TableAdapters.abet_QuestionsTableAdapter adapter = new Data.DataSet1TableAdapters.abet_QuestionsTableAdapter();
            Data.DataSet1.abet_QuestionsDataTable table = adapter.GetQuestions(outcomeID);
            return table;
        } 

        public static int InsertQuestion(Question q)
        {
            Data.DataSet1TableAdapters.abet_QuestionsTableAdapter adapter = new Data.DataSet1TableAdapters.abet_QuestionsTableAdapter();
            int result = adapter.InsertQuestion(q.OutcomeID, q.QuestionText, q.Answer, q.Points);
            return result;
        }

        public static int UpdateQuestion(Question q)
        {
            Data.DataSet1TableAdapters.abet_QuestionsTableAdapter adapter = new Data.DataSet1TableAdapters.abet_QuestionsTableAdapter();
            int result = adapter.UpdateQuestion(q.QuestionText, q.Answer, q.Points, q.QuestionID);
            return result;
        }

        public static int DeleteQuestion(Question q)
        {
            Data.DataSet1TableAdapters.abet_QuestionsTableAdapter adapter = new Data.DataSet1TableAdapters.abet_QuestionsTableAdapter();
            int result = adapter.DeleteQuestion(q.QuestionID);
            return result;
        }

        public static int DeleteQuestions(Guid outcomeID)
        {
            Data.DataSet1TableAdapters.abet_QuestionsTableAdapter adapter = new Data.DataSet1TableAdapters.abet_QuestionsTableAdapter();
            int result = adapter.DeleteQuestions(outcomeID);
            return result;
        }
    }
}
